<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<style type="text/css">
{literal}
/* popup_box DIV-Styles*/
#popup_box,#popup_box1 { 
	display:none; /* Hide the DIV */
	position:fixed;  
	_position:absolute; /* hack for internet explorer 6 */  
	height:350px;  
	width:400px;  
	background:#FFFFFF;  
	left: 300px;
	top: 50px;
	z-index:100; /* Layering ( on-top of others), if you have lots of layers: I just maximized, you can change it yourself */
	margin-left: 15px;  
	
	/* additional features, can be omitted */
	border:2px solid #ffffff;  	
	padding:15px;  
	font-size:15px;  
	-moz-box-shadow: 0 0 5px #ff0000;
	-webkit-box-shadow: 0 0 5px #ff0000;
	box-shadow: 0 0 10px #123456;
	
}



a{  
cursor: pointer;  
text-decoration:none;  
} 

/* This is for the positioning of the Close Link */
#popupBoxClose {
	font-size:20px;  
	line-height:15px;  
	right:5px;  
	top:5px;  
	position:absolute;  
	color:#6fa5e2;  
	font-weight:500;  	
}
{/literal}
</style>
<link rel="stylesheet" type="text/css" href="css/flexigrid.css" />
<script type="text/javascript" src="js/jquery-1.2.3.pack.js"></script>
<script type="text/javascript" src="js/flexigrid.js"></script>
<script type="text/javascript">
{literal}
function loadPopupBox(name) 
{	// To Load the Popupbox
	$(name).fadeIn("slow");
		
}

function unloadPopupBox(name) 
{	// TO Unload the Popupbox
	$(name).fadeOut("slow");
	
}




function doClick()
{
	var form1 = document.d1;
	if(form1.amount.value == "")
		alert("请输入具体优惠");
	else {
		//form1.submit();
		//ajax调用
		
		var tmp = form1.type.value+","+form1.amount.value+","+form1.name.value+","+form1.description.value+","+form1.startdate.value+","+form1.enddate.value;
		
		$.ajax({
			   type: "POST",
			   dataType: "json",
			   url: "?act=discount.add_discount",
			   data: "items="+tmp,
			   success: function(data){
				   
			   	   alert("添加成功");
			   	   unloadPopupBox('#popup_box');
			       $("#flex1").flexReload();
			   }
			 });
	}
	
}
$(document).ready(function(){
	
	$("#flex1").flexigrid
			(
			{
				url: '?act=discount.discount_product_show',
				dataType: 'json',

			colModel : [
				{display: 'ID', name : 'ID', width : 40, sortable : true, align: 'center'},
				{display: 'ProductName', name : 'pname', width : 200, sortable : true, align: 'center'},
				{display: 'DiscountName', name : 'dname', width : 120, sortable : true, align: 'left'},
				{display: 'Amount', name : 'Amount', width : 60, sortable : true, align: 'left'},
				],
			buttons : [
				
			
				],
			searchitems : [
                
				{display: 'ID', name : 'dp.id', isdefault: true},
				{display: 'DiscountName', name : 'd.name'}
				],
			sortname: "dp.id",
			sortorder: "asc",
			usepager: true,
			title: '折扣信息',
			useRp: true,
			rp: 25,
			showTableToggleBtn: true,
			width: 'auto',
			height: 'auto',
			gridClass: "bbit-grid",
			procmsg: '正在获取数据，请稍候 ...'  
			}
			);   
	
	
});

function sortAlpha(com)
{ 
    jQuery('#flex1').flexOptions({newp:1, params:[{name:'letter_pressed', value: com},{name:'qtype',value:$('select[name=qtype]').val()}]});
    jQuery("#flex1").flexReload(); 
}




{/literal}
</script>
</head>
<body>
<div>
<table id="flex1" style="display:none"></table>
</div>
</body>
</html>